<!--
 * @Description: 
 * @Version: 1.0
 * @Autor: younghxp
 * @Date: 2020-09-18 09:41:02
 * @LastEditors: younghxp
 * @LastEditTime: 2021-12-08 14:43:58
-->
<template>
  <div class="container">
    <topTitle :titleText="titleText" :titleExplain="titleExplain"></topTitle>
    <el-tabs
      v-if="!isEsUser()"
      v-model="activeName"
      type="card"
      @tab-click="handleClick"
      class="commonTab"
    >
      <el-tab-pane
        :label="item.label"
        :name="item.value"
        v-for="(item, index) in enterpriseType"
        :key="index"
      >
      </el-tab-pane>
    </el-tabs>
    <div :class="isEsUser() ? 'mainCon ESmainCon' : 'mainCon'">
      <scoreTable
        :scoreDimType="isEsUser() ? '' : scoreDimType"
        :isIndex="isIndex"
      ></scoreTable>
    </div>
  </div>
</template>

<script>
import topTitle from '@/components/publicCom/topTitle'
import scoreTable from './scoreTable'
export default {
  name: 'scoreList',
  components: {
    topTitle,
    scoreTable,
  },
  data() {
    return {
      titleText: '企业评价列表',
      titleExplain: '',
      enterpriseType: [
        { label: '建设单位', value: '0' },
        { label: '施工单位', value: '5' },
        { label: '分包单位', value: '10' },
      ],
      // scoreDimTypeEnum: ["0", "5", "10"],
      scoreDimType: '0',
      isIndex: 0,
    }
  },
  // beforeRouteEnter(to, from, next) {
  //     //   if (from.name === "scoreProjectList") {
  //     //     next((vm) => {
  //     //       vm.isIndex = from.query.index;
  //     //       vm.scoreDimType = vm.scoreDimTypeEnum[vm.isIndex * 1];
  //     //     });
  //     //   } else {
  //     //     next();
  //     //   }
  //     next((v) => {
  //     });
  // },
  // created() {
  //     if (
  //         this.$store.state.userType == "PROJECT_ADMINISTRATOR" ||
  //         this.$store.state.userType == "LABOR_ADMINISTRATOR"
  //     ) {
  //         // this.isXM = true;
  //         this.$router.push({
  //             path: "/home/enterpriseScore/scoreDetail",
  //             name: "scoreDetail",
  //             // query: {
  //             // id: row.enterpriseId,
  //             // enterpriseName: row.enterpriseName,
  //             // scoreDimType: this.scoreDimType,
  //             // index: this.isIndex,
  //             // },
  //         });
  //         this.$store.commit("CHANGE_SLIDER_NAME", {
  //             oldUrl: "/home/enterpriseScore/scoreList",
  //             newUrl: this.$router.currentRoute.fullPath,
  //         });
  //     }
  // },
  methods: {
    handleClick(e) {
      this.activeName = e.name
      this.scoreDimType = e.name
    },
  },
}
</script>

<style lang="less" scoped>
.container {
  .mainCon {
    padding-top: 0;
  }
  .topCon {
    margin-bottom: 0;
  }
}
</style>
